package com.baitiaojun.elasticsearch.api;

import com.baitiaojun.api.domain.video.VideoChildComment;
import com.baitiaojun.api.domain.video.VideoComment;
import com.baitiaojun.api.exception.ConditionException;
import com.baitiaojun.api.vo.JsonRes;
import com.baitiaojun.api.vo.PageInfo;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.Set;

/**
 * @类名 VideoCommentApi
 * @描述 TODO
 * @作者 白条君
 * @创建日期 2022/12/26 21:37
 * @版本 1.0
 */
@RequestMapping("/elasticsearch")
public interface VideoCommentApi {

    @PostMapping("/new-video-comment")
    JsonRes saveVideoComment(@RequestBody VideoComment videoComment) throws ConditionException;

    @PostMapping("/new-child-video-comment")
    JsonRes saveChildVideoComment(@RequestBody VideoChildComment videoChildComment) throws ConditionException;

    @GetMapping("/parent-video-comment")
    VideoComment getParentVideoComment(@RequestParam Long id, @RequestParam Long videoId);

    @GetMapping("/parent-video-comment-list")
    List<VideoComment> getParentVideoCommentList(@RequestParam Integer pageNo, @RequestParam Integer size, @RequestParam Long videoId);

    @GetMapping("/child-video-comment-list")
    List<VideoChildComment> getChildVideoCommentList(@RequestParam("ids") Set<Long> ids) throws IOException;

    @GetMapping("/page-child-video-comment-list")
    PageInfo getPageChildVideoCommentList(@RequestParam Integer pageNo, @RequestParam Integer pageSize, @RequestParam Long videoId, @RequestParam Long rootId);

    @DeleteMapping("/cancel-video-child-comment")
    void removeVideoChildComment(@RequestParam Long id);

    @DeleteMapping("/cancel-video-comment")
    void removeVideoComment(@RequestParam Long id);

    @GetMapping("/search-video-child-comment")
    JsonRes getVideoChildComment(@RequestParam Long id) throws ConditionException;

    @GetMapping("/search-video-comment-list")
    List<VideoComment> getVideoCommentList(@RequestParam("userId") Long userId) throws IOException;

    @GetMapping("/search-video-child-comment-list")
    List<VideoChildComment> getVideoChildCommentList(@RequestParam("ids") Set<Long> ids);
}
